package com.da_client_rn.adapter;

import androidx.annotation.NonNull;
import androidx.annotation.Nullable;
import androidx.fragment.app.Fragment;
import androidx.fragment.app.FragmentManager;
import androidx.fragment.app.FragmentPagerAdapter;

import com.da_client_rn.fragment.Tab1Fragment;
import com.da_client_rn.fragment.Tab2Fragment;
import com.da_client_rn.fragment.Tab3Fragment;

public class ViewPagerAdapter extends FragmentPagerAdapter {

    public  ViewPagerAdapter (FragmentManager fm) {
        super(fm);
    }

    @NonNull
    @Override
    public Fragment getItem(int position) {
        switch (position){
            case 0 :
                return  new Tab1Fragment();
            case  1:
                return  new Tab2Fragment();
            case 2:
                return  new Tab3Fragment();
            default:
                return  null;
        }
    }

    @Override
    public int getCount() {
        return 3;
    }


    @Nullable
    @Override
    public  CharSequence getPageTitle(int positon) {

        switch (positon) {
            case 0:
                return  "TAb1";
            case 1:
                return  "TBA2";
            case 2:
                return  "TAB3";
            default:
                return  null;
        }
    }

}
